package com.ls.springbootdemo.controller;

import com.ls.springbootdemo.model.User;
import com.ls.springbootdemo.service.PageService;
import com.ls.springbootdemo.service.TransService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 挥之以墨
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private TransService transService;
    @Autowired
    private PageService pageService;

    @GetMapping("/insert")
    public String insert(User user) {
        transService.addUser(user);
        return "success";
    }

    @GetMapping("/queryPage")
    public List<User> queryPage(){
       return pageService.queryUser();
    }

}
